package cn.wolfcode.wolf2w.util;

import cn.wolfcode.vo.StrategyStatisVO;
import lombok.Getter;

/**
 * redis的key管理枚举类
 */
@Getter
public enum RedisKeys {
    //短信验证码
    VERIFY_CODE("verify_code", Consts.VERIFY_CODE_VAI_TIME*60L),
    USER_LOGIN("login", Consts.USER_INFO_TOKEN_VAI_TIME*60L),
    //最大时间 登录次数
    USER_LOGCOENT("logcoent",Long.MAX_VALUE),

    USER_STRATEGY_FAVORNUM("user_strategy_favornum",-1L),
    //顶
    STRATEGY_THUMP("strategy_thump",-1L),


    //攻略统计vo的实例对象
    STRATEGY_STATIS_VO("strategy_statis_vo",-1L);
    private String prefix;//key的前缀
    private Long time;//key有效时间 s
    //构造器
    private RedisKeys(String prefix, Long time){
        this.prefix = prefix;
        this.time = time;
    }
    public String join(String ...values){
        //长度为100
        StringBuilder sb = new StringBuilder(100);
        sb.append(this.prefix);
        for (String value:values){
            sb.append(":").append(value);
        }
        return sb.toString();
    }


}
